// pages/auth/index.js
import { login } from "../../utils/asyncWx.js";
import { request } from "../../request/index";
Page({
 async handleGetUserInfo(e) {
    let { encryptedData, rawData, iv, signature } = e.detail;
    let {code} = await login();
    console.log(code);
    
    let loginParams = { encryptedData, rawData, iv, signature, code };
    request({ url: "/users/wxlogin", data: loginParams, method: "post" }).then(
      (result) => {
        console.log(result);
        
        wx.setStorageSync('token', result.statusCode);
        wx.navigateBack({
          delta: 1
        });
      }
    );
  },
});
